<?php
require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../Mqtt.php';

$mqtt = new Mqtt;
$mqtt->createChannel();

$queueName = "router-queue";
$exchangeName = 'router-exchange';
$routerKey = 'error';
$mqtt->createExchange($exchangeName, 'direct');
$mqtt->createQueue($queueName);
$mqtt->bindQueueAndExchange($queueName, $exchangeName, $routerKey);

$mqtt->consumeMsg(function($msg){
    echo $msg . PHP_EOL;
});

$mqtt->close();